package com.hunan.api.catv.action.cos;

import com.hunan.api.catv.action.BaseAction;
import com.hunan.api.catv.annotation.MemberAuth;
import com.hunan.api.catv.common.Api;
import com.hunan.api.catv.entity.Result;
import com.hunan.api.catv.service.biz.tencent_cloud.cos.CosBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: wangchao
 * @Date: 2020/11/24 10:18
 */
@RestController
@Validated
@RequestMapping(Api.cos)
public class CosAction extends BaseAction {

    @Autowired
    CosBiz cosBiz;

    /**
     * 文件圖片上傳
     */
    @MemberAuth
    @PostMapping("/upload/{fileType}")
    public Result notify(@PathVariable Integer fileType, MultipartFile file) {
        return buildResult(cosBiz.upload(fileType, file));
    }
}
